package com.intelligentclass.repositories;

import com.intelligentclass.entity.Homework;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface HomeworkRespository extends JpaRepository<Homework, Integer> {
    @Query("select h from Homework h where h.cid = :cid")
    public Homework findByCidAndSno(@Param("cid") int cid);

    @Query("select h.hname from Homework h where h.hid = :hid")
    public String findHnameByHid(@Param("hid") int hid);

    @Query("select h from Homework h where h.hname = :hname and h.cid = :cid")
    public Homework findByHnameAndCid(@Param("hname") String hname, @Param("cid") int cid);
}
